<!--{subtemplate inc/header}-->
<link type="text/css" rel="stylesheet" href="{PUBLIC_PATH}js/jquery.datepicker.css" />
<script type="text/javascript" src="{PUBLIC_PATH}js/jquery.datepicker.js"></script>
<style type="text/css">
#body-left .site-list dd .goweb{_background:none;_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{TPL_PATH}images/web-show.png',sizingMethod='scale');}
</style>
<script type="text/javascript">
<!--{dynamic getGoodsDynamics args=$goods_result['ids']}-->
</script>
<div class="blank12"></div>
<div class="hbox">
	<dl class="goods-site-list">
		<dt><strong>$_FANWE[current_city][name]往期团购</strong></dt>
		<dd id="goods-index-scroll">
			<!--{loop $goods_sites $goods_site}-->
			<div class="sia {if $goods_site['id'] == $site_id}current{/if}">
				<a class="siag" href="javascript:;" siteID="$goods_site[id]">$goods_site[name]</a>
			</div>
			<!--{/loop}-->
			<div class="blank9"></div>
		</dd>
	</dl>
	<div class="blank9"></div>
	<div class="list-goods-search">
		<!--{if $cate_id > 0}-->
		<!--{eval $root_id = $cate_id;}-->
		<!--{eval $current_cate = $_FANWE['cache']['goods']['cats'][$cate_id];}-->
		<!--{if $current_cate['pid'] > 0}-->
		<!--{eval $root_id = $current_cate['pid'];}-->
		<!--{/if}-->
		<!--{/if}-->
		<div class="lgs-item lgs-cate">
			<div class="lgsi-title">分类</div>
			<div class="lgsi-list">
				<a href="javascript:;" class="{if $cate_id == 0}active{/if}{if $goods_cates['gcount'] == 0} disabled{/if}" cateID="0">全部 <span>($goods_cates['gcount'])</span></a>
				<!--{loop $_FANWE['cache']['goods']['root_cates'] $rootid}-->
				<!--{eval $root_count = $goods_cates['cates'][$rootid];}-->
				<!--{eval $root_cate = $_FANWE['cache']['goods']['cats'][$rootid];}-->
				<a href="javascript:;" class="{if $root_id == $rootid}active{/if}{if $root_count == 0} disabled{/if}" cateID="$rootid">$root_cate['name'] <span>($root_count)</span></a>
				<!--{/loop}-->
			</div>
		</div>
		<!--{eval $root_cate = $_FANWE['cache']['goods']['cats'][$root_id];}-->
		<!--{if isset($root_cate['childs'])}-->
		<div class="lgs-item cate-sub lgs-cate">
			<div class="lgsi-list">
				<strong>$root_cate['name']:</strong>
				<!--{loop $root_cate['childs'] $childid}-->
				<!--{eval $cate_count = $goods_cates['cates'][$childid];}-->
				<!--{eval $cate = $_FANWE['cache']['goods']['cats'][$childid];}-->
				<a href="javascript:;" class="{if $cate_id == $childid}active{/if}{if $cate_count == 0} disabled{/if}" cateID="$childid">$cate['name'] <span>($cate_count)</span></a>
				<!--{/loop}-->
			</div>
		</div>
		<!--{/if}-->
		<div class="lgs-item lgs-price">
			<div class="lgsi-title">价格</div>
			<div class="lgsi-list">
				<a href="javascript:;"{if empty($prices)} class="active"{/if} price="0,0">全部</a>
				<a href="javascript:;"{if $prices == '0,100'} class="active"{/if} price="0,100">0-100元</a>
				<a href="javascript:;"{if $prices == '100,300'} class="active"{/if} price="100,300">100-300元</a>
				<a href="javascript:;"{if $prices == '300,500'} class="active"{/if} price="300,500">300-500元</a>
				<a href="javascript:;"{if $prices == '500,0'} class="active"{/if} price="500,0">500元以上</a>
			</div>
		</div>
	</div>
	<div class="list-goods-sort">
		<div class="actions">
			<label style="float:left;border: #bbb 1px solid;"><span style="float:left; padding:4px 0 0 3px;">日期：</span><input type="text" id="date" readonly="readonly" value="$date" style="border:none 0 #fff; border-left:solid 1px #bbb; padding:2px; width:72px;float:left;"/></label>
		</div>
		<div class="sort">
			<a href="javascript:;"{if empty($sort)} class="default"{/if} sort="">默认排序</a>
			<a href="javascript:;"{if $sort == 'spd'} class="currentd" sort="spa"{elseif $sort == 'spa'} class="currenta" sort="spd"{else} sort="spa"{/if}>价格排序</a>
			<a href="javascript:;"{if $sort == 'dd'} class="currentd" sort="da"{elseif $sort == 'da'} class="currenta" sort="dd"{else} sort="da"{/if}>折扣排序</a>
			<a href="javascript:;"{if $sort == 'bd'} class="currentd" sort="ba"{elseif $sort == 'ba'} class="currenta" sort="bd"{else} sort="bd"{/if}>销量排序</a>
			<a href="javascript:;"{if $sort == 'etd'} class="currentd" sort="eta"{elseif $sort == 'eta'} class="currenta" sort="etd"{else} sort="eta"{/if}>时间排序</a>
		</div>
		<div class="display {dynamic getDisplayMode}">
			<a href="javascript:;" class="d_grid" mode="grid">网格</a>
			<a href="javascript:;" class="d_row" mode="row">列表</a>
		</div>
	</div>
	<div class="blank9"></div>
	<div id="body-left" class="fl">
		<div id="goods_list_body" class="goods-{dynamic getDisplayMode}-body">
			<div class="glb-list" style="border-top:solid 1px #eb5106;">
			<!--{if count($goods_result['list']) > 0}-->
			<ul>
				<!--{loop $goods_result['list'] $goods}-->
				<!--{if defined('IS_CACHE_TPL')}-->
				<!--{eval $goods['bought'] = '<script type="text/javascript">document.write(goodsDynamics["g_'.$goods['id'].'"]["bought"]);</script>';}-->
				<!--{eval $goods['post_count'] = '<script type="text/javascript">document.write(goodsDynamics["g_'.$goods['id'].'"]["post"]);</script>';}-->
				<!--{eval $goods['collect_count'] = '<script type="text/javascript">document.write(goodsDynamics["g_'.$goods['id'].'"]["collect"]);</script>';}-->
				<!--{eval $goods['click_count'] = '<script type="text/javascript">document.write(goodsDynamics["g_'.$goods['id'].'"]["click"]);</script>';}-->
				<!--{/if}-->
				<li class="item">
					<div class="site_gname">
						<div class="site">
							<a href="$goods[site_url]" target="_blank">$goods[site_name]</a>
						</div>
						<div class="name">
							<a href="$goods[url]" target="_blank" title="{$goods[site_name]}：{$goods[city]}今日团购:$goods[name]" style="text-align:left;">$goods[name]</a>
						</div>
					</div>
					<div class="img">
						<a href="$goods[url]" target="_blank"><img src="$goods[small_img]" alt="{$goods[site_name]}：{$goods[city]}今日团购:$goods[name]" /></a>
					</div>
					<div class="attrs-list">
						<p class="sprice al">现价：<span>$goods[shop_price_format]</span></p>
						<p class="bought ar">销量：<span>$goods[bought]</span></p>
						<p class="mprice al">原价：<b>$goods[market_price_format]</b></p>
						<p class="post ar">评论：<span>$goods[post_count]</span></p>
						<p class="discount al">折扣：<span>$goods[discount]</span>折</p>
						<p class="collect ar">收藏：<span>$goods[collect_count]</span></p>
						<p class="buy al"><a href="$goods[url]" target="_blank"><img src="{TPL_PATH}images/btn-1.gif" /></a></p>
						<p class="click ar">点击：<span>$goods[click_count]</span></p>
					</div>
					<div class="attrs-text attrs1">
						现价：<span class="sprice">$goods[shop_price_format]</span>
						原价：<b>$goods[market_price_format]</b>
						折扣：<span>$goods[discount]折</span>
						销量：<span>$goods[bought]</span>
					</div>
					<div class="attrs-text attrs2">
						<p class="post">评论：<span>$goods[post_count]</span></p>
						<p class="collect">收藏：<span>$goods[collect_count]</span></p>
						<p class="click">点击：<span>$goods[click_count]</span></p>
						<p class="buy"><a href="$goods[url]" target="_blank"><img src="{TPL_PATH}images/btn-1.gif" /></a></p>
					</div>
					<div class="time">
						结束时间：$goods[end_time_format]
					</div>
					<!--{if $goods['is_best'] == 1}-->
					<span class="best"></span>
					<!--{elseif $goods['is_new'] == 1}-->
					<span class="new"></span>
					<!--{/if}-->
				</li>
				<!--{/loop}-->
			</ul>
			<!--{else}-->
			<div class="empty">没有找到符合条件的团购活动！</div>
			<!--{/if}-->
			<!--{subtemplate inc/pages}-->
			<div class="blank20"></div>
			</div>
		</div>
	</div>
	<div id="body-right" class="fr">
	<!--{subtemplate inc/common/right}-->
	</div>
</div>
<script type="text/javascript">
var cat = "$cate_id";
var city = "{CURRENT_CITY_PY}";
var sortOrder = "$sort";
var site = "$site_id";
var edate = "$date";
var prices = "{$prices}";
var route = $_FANWE['setting']['url_route'];
var depr = "-";
var indexUrl = decodeURIComponent("{echo U('goods/'.ACTION_NAME,array('site'=>'_site_','cat'=>'_cat_','date'=>'_date_','city_py'=>'_city_','sort'=>'_sort_','prices'=>'_prices_'))}");

jQuery(function($){
	$(".img img").lazyload({"placeholder":"{TPL_PATH}images/img_loading.gif","failurelimit":10});
	
	$("#date").datepicker({
			"dayNamesMin":['日', '一', '二', '三', '四', '五', '六'],
			"monthNames":['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
			"maxDate":new Date("$dates['max_time']"),
			"minDate":new Date("$dates['min_time']"),
			"dateFormat":"yy-mm-dd",
			"defaultDate":"$date",
			"onSelect":function(dateText, inst){
				edate = dateText;
				goToUrl();
			}
		});

	$(".sia").hover(function(){
		$(".sia").removeClass("active");
		$(this).addClass("active");
	},function(){
		$(this).removeClass("active");
	});
	
	$(".lgs-cate a").click(function(){
		if($(this).hasClass('disabled'))
			return false;
		cat = this.getAttribute("cateID");
		goToUrl();
	});
	
	$(".list-goods-sort .sort a").click(function(){
		sortOrder = this.getAttribute("sort");
		goToUrl();
	});
	
	$(".lgs-price a").click(function(){
		prices = this.getAttribute("price");
		goToUrl();
	});
	
	$("#goods-index-scroll a").click(function(){
		site = this.getAttribute("siteID");
		goToUrl();
	});
	
	if($("#goods-index-scroll div.current").length > 0)
	{
		$("#goods-index-scroll").scrollTop($("#goods-index-scroll div.current").position().top);
	}

	$(".display a").click(function(){
		mode = this.getAttribute("mode");
		$.cookie(COOKIE_PRE + 'display_mode', mode,{"expires":7});
		$("#goods_list_body").attr("className","goods-"+mode+"-body");
		$(".list-goods-sort .display").attr("className","display "+mode);	
	});
	
});

function goToUrl()
{
	if(site == 0)
		indexUrl = clearParm(indexUrl,'_site_',"",'site');
	else
		indexUrl = clearParm(indexUrl,'_site_',site,'site');
		
	if(cat == 0)
		indexUrl = clearParm(indexUrl,'_cat_',"",'cat');
	else
		indexUrl = clearParm(indexUrl,'_cat_',cat,'cat');
	
	if(edate == '')
		indexUrl = clearParm(indexUrl,'_date_',"",'date');
	else
	{
		edate = edate.replace(/-/g,'/');
		indexUrl = clearParm(indexUrl,'_date_',edate,'date');
	}
	
	if(prices == "0,0")
		indexUrl = clearParm(indexUrl,'_prices_',"",'prices');
	else
		indexUrl = clearParm(indexUrl,'_prices_',prices,'prices');
	
	indexUrl = clearParm(indexUrl,'_city_',city,'city_py');
	indexUrl = clearParm(indexUrl,'_sort_',sortOrder,'sort');
	
    //2011-02-10 update
    var fun = function(){
        location.href=indexUrl;
    };

    setTimeout(fun,1);
}

function clearParm(url,search,replace,parm)
{
	if(replace == "")
	{
		if(route > 0)
			return url.replace(depr+parm+depr+search,"");
		else
			return url.replace("&"+parm+"="+search,"");
	}
	else
		return url.replace(search,replace);
}
</script>
<!--{subtemplate inc/footer}-->